package com.GLM.Viewer.Party;

import com.GLM.Constants.Constant;
import com.GLM.Viewer.R;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class PartyMainActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.view_party_main);
		View view = (View)findViewById(R.id.viewpartymain_layout);
		Animation mAnimIn = AnimationUtils.loadAnimation(PartyMainActivity.this, R.anim.anim_down_in);
		view.setAnimation(mAnimIn);
		final SharedPreferences sp = getSharedPreferences(Constant.SHAREDNAME, MODE_PRIVATE);
		boolean isshow = sp.getBoolean(Constant.PARTYMAINACTIVITY, true);
		final ImageView tipView = (ImageView)findViewById(R.id.tipView);
		if(!isshow){
			tipView.setVisibility(View.VISIBLE);
			tipView.setOnTouchListener(new OnTouchListener() {
				
				public boolean onTouch(View v, MotionEvent event) {
					// TODO Auto-generated method stub
					tipView.setVisibility(View.INVISIBLE);
					tipView.setImageBitmap(null);
					Editor editor = sp.edit();
					editor.putBoolean(Constant.PARTYMAINACTIVITY, true);
					editor.commit();
					System.gc();
					return true;
				}
			});
		}
	}

	public void createNewCircle_OnClick(View v) {
		Intent intent = new Intent(PartyMainActivity.this, CreateNewPartyViewActivity.class);
		startActivity(intent);
	}

	public void goBackButton_OnClick(View v) {
		NavUtils.navigateUpFromSameTask(this);
	}
	
	public void partyHistory_OnClick(View v){
		Intent intent = new Intent(PartyMainActivity.this, PartyHistoryActivity.class);
		startActivity(intent);
	}
	
	public void partyJourney_OnClick(View v){
		Intent intent = new Intent(PartyMainActivity.this,PartyJourneyActivity.class);
		startActivity(intent);
	}
	
	public void partyMeetingPlace_OnClick(View v){
		Intent intent = new Intent(PartyMainActivity.this,PartyMeetingPlaceActivity.class);
		startActivity(intent);
	}

}
